<!--校准管理-->
<template>
	<view>
		<!-- <button class="btn" @click="showAdd" size="mini" type="primary">+ &nbsp;新增</button> -->
		<Tab @change="changeParam" :tabList="tabList" :activeIndex="activeIndex"></Tab>
		<!-- <Listscroll :params="params">
			<template #default="scope"> -->
				<view class="notice-item" v-for="(item,i) in  showList" :key="i" @click="showDetail(item)">
					<view class="notice-item__title">
						<view class="time-text">{{item.creatTime}}</view>
						<view class="time-text">{{item.gasType}}</view>
						<view class="pass-type" v-if="item.isPass== 1">通过</view>
						<view class="not-pass-type" v-if="item.isPass == 0">不通过</view>
					</view>
					<view class="notice-item__containter">
						<text class="standard-name">标准气读数：</text>
						<text class="standard-text">{{item.standardValue}}PPM</text>
						<text class="average-name">平均值：</text>
						<text class="average-text">{{item.averageValue}}PPM</text>
						<text class="error-name">误差：</text>
						<text class="error-text">{{item.differenceValue}}</text>
					</view>
				</view>
		<!-- 	</template>
		</Listscroll> -->
	</view>
</template>

<script setup>
	import {
		ref,
		onMounted
	} from "vue"
	import Tab from '@/components/tabs/tabs2.vue';
	import Listscroll from "@/components/list-scroll/list-scroll.vue"
	import {
		getClassify
	} from "@/api/user.js"
	import {
		    onLoad,
		  } from "@dcloudio/uni-app";
	const params = ref({
		auditStatus: -1
	})
	const types = ref({})
	const status = ref({
		'-1': "待审核",
		1: "已审核",
		0: "已驳回"
	})
	const activeIndex = ref(0)
	const tabList = ref([{
			tabName: '日常校准',
			tabId: '日常',
			id: 0
		},
		{
			tabName: '漂移校准',
			tabId: '漂移',
			id: 1
		},
	])
	const calibrationManagementList = ref([])
	const showList = ref([])
	const changeParam = (e) => {
		console.log('idx-===', e);
		if (e == '日常') {
			activeIndex.value = 0;
		} else {
			activeIndex.value = 1;
		}
		showList.value = calibrationManagementList.value.filter(v => v.correctType === e);
		console.log("showList.value",showList.value);
	}

	
	const showDetail = (item) => {
		uni.navigateTo({
			url: '/pages/testing/addNewCalibration?info=' + encodeURIComponent(JSON.stringify(item))
		});
	}


	onMounted(() => {
		calibrationManagementList.value = uni.getStorageSync('calibrationManagementList');
		//console.log('calibrationManagementList.value',calibrationManagementList.value);
		showList.value = calibrationManagementList.value.filter(v => v.correctType === '日常');
	});
	onLoad((option) => {});
</script>

<style lang="scss" scoped>
	.notice-item {
		display: flex;
		flex-direction: column;
		background: #fff;
		border-radius: 10rpx;
		margin: 20rpx 30rpx 0 30rpx;
		padding: 20rpx;
		cursor: pointer;
	}

	.notice-item__title {
		display: flex;
		justify-content: space-between;
		margin-bottom: 10rpx;

		.title {
			font-weight: bold;
			font-size: 28rpx;
			color: #455BDF;
		}

		.time-text {
			color: #000000;
			font-size: 20rpx;
		}

		.pass-type {
			display: inline-block;
			padding: 4rpx 8rpx;
			background: rgb(227, 248, 228);
			border: 2rpx solid rgb(227, 248, 228);
			color: rgb(18, 167, 42);
			border-radius: 10rpx;
			font-size: 20rpx;

		}

		.not-pass-type {
			display: inline-block;
			padding: 4rpx 8rpx;
			color: #ff0000;
			background-color: #f9eaec;
			border: 2rpx solid #f9eaec;
			border-radius: 10rpx;
			font-size: 20rpx;
		}
	}

	.notice-item__containter {
		text-overflow: -o-ellipsis-lastline;
		overflow: hidden;
		text-overflow: ellipsis;
		display: flex;
		-webkit-line-clamp: 2;
		line-clamp: 2;
		font-size: 28rpx;

		text {
			font-size: 20rpx;
			color: #999;
		}

		.error-text {
			color: #ff0000;
			font-weight: 500;

		}

		.average-text {
			width:100rpx;
			color: #000000;
			font-weight: 500;
		}

		.average-name {
			margin-left: 20rpx;
		}

		.error-name {
			margin-left: 20rpx;
			color:#ff0000;
		}

		.standard-name {}

		.standard-text {
			width:100rpx;
			color: #000000;
			font-weight: 500;
		}
	}

	.btn {
		margin: 30rpx 0 0 30rpx;
		height: 80rpx;
		line-height: 80rpx;
		font-size: 28rpx;
	}
</style>